'''
Created on Aug 28, 2010

@author: alia
'''

import logging
log = logging.getLogger('level complete')


from cocos.director import director
from cocos.layer import Layer, ColorLayer
from cocos.text import Label

from pyglet import clock

class LevelComplete(Layer):
    def __init__(self, success, time):
        super(LevelComplete, self).__init__()
        self.success = success
        self.time = time
        
        self.add(ColorLayer(100,200,100,80))
        
        timedisplay = Label(self.time,font_size=32, color=(190,180,170,255))
        timedisplay.x = 300
        timedisplay.y = 300
        self.add(timedisplay)
        
        clock.schedule_once(self.next, 5)
        
    def next(self,dt):
        if (not self.success):
            director.pop()
            
        director.return_value = self.success
        director.scene.end(self.success)